/**@Title   HashSetDemo2.java
 * @Package com.HashSet
 * @Desc    
 * @Author  GongWenhua
 * @Date    2017年4月27日 下午2:43:24
 * @Version 1.0
*/
package com.HashSet;

import java.util.HashSet;
import java.util.Set;

public class HashSetDemo2 {
	public static void main(String[] args) {
		Set set = new HashSet<>();
		
		User user1 = new User(1001,"Gong");
		User user2 = new User(1002, "Zhang");
		User user3 = new User(1001,"Gong");
		User user4 = new User(1002, "Zhang");
		
		set.add(user1);
		set.add(user2);
		set.add(user3);
		set.add(user4);
		
		System.out.println(set.size());
		
		for(Object obj:set){
			System.out.println(obj);
		}
		
	}
}
